

function streamPublish(name,url, pic, description){        
	
	//alert(name+url+pic+description);
	FB.ui({ method: 'feed',
			name: name,
			link: url,
			picture: pic,
			caption: 'Lara.bg',
			description: description

		  }, function(response) {
			  
			 
			
				$('#slide3').slideUp(300);
				$('#slide2').slideDown(300);
				
			
	   });
		  
		  
		
}



function publishStream(pic,user,like){
	
	 $('.vote').addClass('inactive');
 $('#white').show(100);
	
$.ajax({
	type: "POST",
	url: "http://energysave.bg/like.php",
	data: "catalog_id=" + pic +"&user="+user+"&l="+like,
	success: function(msg){
		
		$('#white').hide();
		if(msg)
		{
			eval(msg);
		}else{
			location.reload();	
		}
		
	},
	error: function(msg){
		alert(msg);
	}
});



}

function logout(){

	FB.logout(function(response) {
		  location.reload();
		});
}

function login()
{
	
	 FB.login(function(response) {
		 
	   if (response.authResponse) {
		 location.reload();
		 
		 
	   } else {
		 console.log('User cancelled login or did not fully authorize.');
	   }
	   
	 }, {scope: 'email,publish_stream,user_likes'});
}

function fantest(){
		var user_id = response.session.uid;
         var page_id = "230517553823197"; //coca cola
		FB.api({
		method:     'fql.query', 
		query:  'SELECT uid FROM page_fan WHERE uid='+user_id+' AND page_id=230517553823197'
	}, function(resp) {
		if (resp.length) {
			alert('A fan!')
		} else {
			alert('Not a fan!');
		}
	}
	);
}